﻿
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using CrystalDecisions.CrystalReports.Engine;
using System.Data;
using System.Text;
using System.Xml;
using Gift.WebApp;
using Gift.Model;
using Gift.DAL;
namespace WebApp.admin.basic
{
    public partial class paymentList : BaseAdmin
    {
        // Fields
        protected string xmlPath = "/cn/xml/payment.xml";

        // Methods
        protected void Page_Load(object sender, EventArgs e)
        {
            //if ((HttpContext.Current.Session["admin_user"] == null) && (HttpContext.Current.Session["language_version"] == null))
            //{
            //    base.ClientScript.RegisterStartupScript(base.GetType(), "sJs", "top.location=\"login.html\";", true);
            //}
        }

        protected StringBuilder PaymentBind()
        {
            StringBuilder builder = new StringBuilder();
            try
            {
                XmlDocument document = new XmlDocument();
                document.Load(base.Server.MapPath(this.xmlPath));
                XmlNodeList childNodes = document.SelectSingleNode("paymentMethod").ChildNodes;
                builder.AppendLine("<tbody>");
                foreach (XmlNode node in childNodes)
                {
                    if (node.Attributes["companyId"].Value == base.Administrator.CompanyId)
                    {
                        XmlElement element = (XmlElement)node;
                        builder.AppendLine("<tr>");
                        builder.AppendLine("<td><img style=\"border:solid 1px #d3d3d3;\" src=\"" + element.GetAttribute("image") + "\" alt=\"" + element.GetAttribute("title") + "\" /></td>");
                        builder.AppendLine("<td>" + element.GetAttribute("title") + "</td>");
                        builder.AppendLine("<td>" + element.GetAttribute("remark") + "</td>");
                        builder.AppendLine("<td><a href=\"" + element.GetAttribute("url") + "\" target=\"_blank\">申请接口权限</a></td>");
                        builder.AppendLine("<td>" + ((element.GetAttribute("checked") == "true") ? "是" : "否") + "</td>");
                        builder.AppendLine("<td><div style=\"float:left; display:block;\" id=\"divEdit\" runat=\"server\">  <a href=\"payment.aspx?id=" + element.GetAttribute("id") + "\"  title=\"配置\">[配置]</a></div></td>");
                        builder.AppendLine("</tr>");
                    }
                }
                builder.AppendLine("</tbody>");
            }
            catch
            {
            }
            return builder;
        }

    }
}